import { instance } from '../utils/http'

// 用户登录
export const userWxLoginService = (code) => {
  return instance.post(`/user/wxlogin/${code}`)
}

// 用户退出登录
export const userLogout = (openId) => {
  return instance.delete(`/user/logout`, {openId: openId})
}

// 用户修改个人头像
export const userModifyAvatarService = (avatar) => {
  return instance.put(`/user/modifyAvatar`, { avatarUrl: avatar })
}

// 用户修改用户名
export const userModifyUserNameService = (userName) => {
  return instance.put(`/user/modifyUserName/${userName}`)
}

// 用户修改性别
export const userModifyUserGenderService = (gender) => {
  return instance.put(`/user/modifyGender/${gender}`)
}

// 用户修改个人简介
export const userModifyUserDescriptionService = (description) => {
  return instance.put(`/user/modifyDescription`, { description: description })
}

// 用户修改微信号
export const userModifyUserWeChatIdService = (weChatId) => {
  return instance.put(`/user/modifyWeChatId/${weChatId}`)
}

// 用户修改QQ号
export const userModifyUserQQIdService = (qqId) => {
  return instance.put(`/user/modifyQQId/${qqId}`)
}

// 用户修改标签
export const userModifyTagsService = (tags) => {
  return instance.put(`/user/modifyTags`, { tags: tags })
}

// 用户首页推荐
export const userGetHomePageRecommendation = (tags) => {
  return instance.get(`/user/recommend`, { tags: tags })
}

// 用户搜索
export const userSearchUserByKeyword = (keyword, page, pageSize) => {
  return instance.get(`/user/search`, { keyword: keyword, page: page, pageSize: pageSize })
}

// 获取用户详细信息
export const userGetUserdetail = (id) => {
  return instance.get(`/user/getDetail/${id}`)
}